LanguageAPI Server Control

The LanguageAPI server control lets a developer force a particular language for a Web site. You can do this by dropping the server control on the page and setting a language in the SiteLanguage property box. You can also override site language logic by programmatically using the LanguageAPI server control to detect the browser’s language, and display the site in that language.

LanguageSelect Server Control vs. LanguageAPI Server Control

The LanguageSelect server control lets users view your site in the language they choose. The LanguageAPI server control, on the other hand, forces users to view a site in a particular language. For information on LanguageSelect, see LanguageSelect Server Control.

LanguageAPI Server Control Properties

The LanguageAPI server control properties are described in this table.

Note: The following table only lists Ektron-specific properties. It does not describe native .NET properties such as font, height, width and border style. For documentation of these properties, see Visual Studio help.

Property

Value

Data Type

SiteLanguage

Sets the site language. Runs through the IsValid function to verify that the language is an active language in the system.

String

SiteLanguageID

Numeric value of the site language. This is the property you will use if you are using code behind to set the sites language ID.

Example: 1036 = French

For a list of supported languages, go to Ektron CMS400.NET Workarea > Settings > Configuration > Language Settings.

Integer

Code Behind Only Properties and Methods

The following is a list of LanguageAPI specific properties and methods that can only be used programmatically.

Property

Value

Data Type

CurrentLanguage

Read only. Returns the current language.

String

CurrentLanguageID

Read only. Returns the current language ID.

Integer

DefaultLanguage

Read only. What the default language of the site is set to. For example, the demo site is “English (Standard)”.

String

DefaultLanguageID

Read only. Returns the value that is the default language ID of the site. For example, the demo site is “1033” for English.

Integer

GetLanguage

This method returns a string. Pass in a valid language ID and it will return the language name.

Integer Argument

GetLanguageID

This method returns an integer. Pass in a valid language name and it will return the language ID.

String Argument

IsValid

This method returns a boolean. You can pass in a language ID or a string and it will tell you if the system is supporting it.

Argument

LanguageIdList

Read only. Lists all the language IDs that are activated in Ektron CMS400.NET.

For information on how to enable languages, see Determining Which Languages are Available.

Array of Integers

LanguageTitleList

Read only. Lists all the languages that are activated in Ektron CMS400.NET.

Array of Strings

MultiLanguageEnabled

Read only. Tells if the site supports multi-language mode.

True = Multi-language enabled

False = Multi-language not enabled

Multi-language is enabled by default. To disable it, see Enabling/Disabling Support for Multiple Language Content.

Boolean

Using the LanguageAPI Server Control Programmatically

This example uses a logo that is not managed through Ektron CMS400.NET. It retrieves the current language from the LanguageAPI control, and uses that information to choose the logo version to display. The codebehind looks like this.

Select Case LanguageAPI1.CurrentLanguageID

Case 1031

Image1.ImageUrl = "germanlogo.gif"

Case 1033

Image1.ImageUrl = "englishlogo.gif"

Case 1036

Image1.ImageUrl = "frenchlogo.gif"

End Select

Previous TopicNext Topic|